package com.mostsnails.common.base.utils.config;

import com.mostsnails.common.base.utils.aspect.WebLogAspect;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;

/**
 * Web日志加入Spring容器
 *
 * @Author MostSnails
 * @Version 1.0
 */
public class WebLogAutoConfiguration {
    private static org.slf4j.Logger log = LoggerFactory.getLogger(WebLogAutoConfiguration.class);

    public WebLogAutoConfiguration() {
        log.info("Web日志记录配置类.....Start");
    }

    @Bean
    @ConditionalOnWebApplication
    @ConditionalOnMissingBean(WebLogAspect.class)
    public WebLogAspect webLogAspect() {
        log.info("注入webLogAspect类.....");
        return new WebLogAspect();
    }
}
